package itstudio.instructor.ui;

import itstudio.app.wq.R;
import itstudio.instructor.config.MyApplication;
import itstudio.instructor.entity.Comment;
import itstudio.instructor.util.TimeUtil;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class MessageDetailActivity extends Activity{
	private View back_view;
	private TextView message_author;
	private TextView message_title;
	private TextView message_date;
	private TextView message_content;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_message_detail);
		back_view=findViewById(R.id.back_layout_message_detail);
		message_author=(TextView) findViewById(R.id.message_author);
		message_title =(TextView) findViewById(R.id.message_title);
		message_date=(TextView) findViewById(R.id.message_date);
		message_content=(TextView) findViewById(R.id.message_content);
		Comment comment = (Comment) getIntent().getExtras().get("comment");
		message_author.setText(comment.getAuthorName());
		message_title.setText(comment.getNews().getTitle());
		message_date.setText(TimeUtil.dateToString(comment.getPostTime(),TimeUtil.FORMAT_DATE_TIME));
		message_content.setText(comment.getContent());
		if(comment.getAuthorId().equals(MyApplication.user.getId())){
			message_author.setText(R.string.me);
		}
		back_view.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});
	}

}
